/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tp_imag.gui.components;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

/**
 *
 * @author Administrador
 */
public class ImageComponent extends Component {
    BufferedImage img;

    @Override
    public void paint(Graphics g) {
        g.drawImage(img, 0, 0, null);
    }

    public ImageComponent() {
       try {
           img = ImageIO.read(new File("Perfil3.jpg"));
       } catch (IOException e) {
       }

    }

    @Override
    public Dimension getPreferredSize() {
        if (img == null) {
             return new Dimension(100,100);
        } else {
           return new Dimension(img.getWidth(null), img.getHeight(null));
           //img.getGraphics().
            //return new Dimension(100,100);
       }
    }



}
